<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>极速牌照-登录</title>
		<link rel="stylesheet" href="<?php echo $WEB_ROOT ?>/Public/home/css/g.css" />
		<link rel="stylesheet" href="<?php echo $WEB_ROOT ?>/Public/home/css/login.css" />
		<script src="<?php echo $WEB_ROOT ?>/Public/home/js/jquery.min.js"></script>
		<script>
			$(function(){
				$("#tel").blur(function(){
					var phone = $("#tel").val();
					
					if(!!phone){
						if(!/1\d{10}/.test(phone)){
							$("#errtip1").find("span").text("手机号格式错误，请重新输入");
							$("#errtip1").show();
						}else{
							$("#errtip1").hide();
						}
					}else{
						$("#errtip1").find("span").text("请输入手机号");
						$("#errtip1").show();
					}
					
				});
				$("#password").blur(function(){
					var password = $("#password").val();
					if(!!password){
						//这里进行登录验证
						$.get('<?php echo $WEB_ROOT ?>/index.php/Home/User/checkPwd.html',{tel:$("#tel").val(),password:$("#password").val()},function(data){
							if('failed'==data){
								//登录失败执行这里
								$("#errtip").find("span").text("账户或密码错误，请重新输入");
								$("#errtip").show();
							}else{
								$("#errtip").hide();
							}
						},'html');
						
					}else{
						$("#errtip").find("span").text("请输入密码");
						$("#errtip").show();
					}
					
				});
				$("#loginbtn").click(function(){
					var tel = $("#tel").val();
					var password = $("#password").val();
					$.get("<?php echo $WEB_ROOT ?>/index.php/Home/User/login.html",{tel:tel,password:password},function(data){
						if('success'==data['STATUS']){
							var area = data['RESULT']['temp_area'];
							var pid = data['RESULT']['temp_pid'];
							var service_way = data['RESULT']['temp_sway'];
							var service_type = data['RESULT']['temp_type'];
							location.href='<?php echo $WEB_ROOT ?>/index.php/Home/Order/createOrder/pid/'+pid+'/area/'+area+'/service_type/'+service_type+'/service_way/'+service_way;
						}else{
							$("#errtip").find("span").text(data['MSG']);
						}
					},'json');
				});
				
			});
		</script>		
	</head>
	<body>
		<div id="page">
			<!--
            	描述：顶部logo区域
            -->
			<div id="topbar">
				<a href="<?php echo U('Index/index') ?>"><img id="logo" src="<?php echo $WEB_ROOT ?>/Public/home/img/logo_white.svg" /></a>
				<div id="sep"></div>
				<p id="welcome">欢迎登录</p>
				
			</div>
			<div id="line"></div>
			<!--
            	描述：登录注册区
            -->
			<div id="middlebar">
				<form id="loginform" name="loginform" method="post" enctype="application/x-www-form-urlencoded">
					<input class="txt" type="text" id="tel" name="tel" maxlength="20" placeholder="手机号码" required="required" />
					<p id="errtip1"><img style="vertical-align: middle;" src="<?php echo $WEB_ROOT ?>/Public/home/img/red.png"><span>手机号格式错误，请重新输入</span></p>
					<input class="txt" type="password" id="password" name="password" placeholder="密码" required="required"  maxlength="20"/>
					<p id="errtip"><img style="vertical-align: middle;" src="<?php echo $WEB_ROOT ?>/Public/home/img/red.png"><span>账号或密码错误，请重新输入</span></p>
					<input class="btn" type="button" id="loginbtn" name="loginbtn" value="极速登录"  />
					<a class="btn"  id="registerbtn" href="<?php echo U('User/checkRegister')?>">极速注册</a>
				</form>
			</div>
			<!--
            	描述：尾部版权区
            -->
			<footer id="bottombar">
				Copyright © 2015-2016 黑珍珠网络科技有限公司 京ICP备15017192号-1 <script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_1260826665'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s4.cnzz.com/z_stat.php%3Fid%3D1260826665%26show%3Dpic1' type='text/javascript'%3E%3C/script%3E"));</script>
			</footer>
		</div>
	</body>
</html>
